home *** CD-ROM | disk | FTP | other *** search
- #include "stdafx.h"
-
- cRolling::cRolling(int _x, int _y, cProperties *_orig)
- : cWeapon(_x, _y, _orig, "MOVING")
- {
- move_object_after_hit = FALSE;
- }
-
- cRolling::~cRolling()
- {
- }
-
- int cRolling::control()
- {
- cWeapon::control();
-
- bounce_on_boundaries();
-
- // Rotate
-
- if (circle_bounds != 0)
- set_rotation_angle(get_rotation_angle() - 41 * vx * roll_timer.delta() / circle_bounds->radius);
-
- // Kill object if we hit something or when we are in water
-
- return !((abs(vx) > (fix)5 || !resting) && check_radial_hit_one(circle_bounds)) && !in_water();
- }
-
- void cRolling::hit(fix dir, cWeapon *w)
- {
- // Push if weapon has push power
-
- if (w->push_power > 0 || w->instant_push_speed > (fix)0)
- add_angular_speed(50, dir);
- }
-